<template>
  <div class="shopping-evaluate">
    <!-- <div class="evaluate-body"> -->
      <div class="evaluate-header">
        <p class="evaluate-font">5.0</p>
        <div class="evaluate-header__item">
          <p>商家评价</p>
          <p>❤❤❤❤❤</p>
        </div>
        <div class="evaluate-header__taset">
          <p>味道</p>
          <p>5.0</p>
        </div>
        <div class="evaluate-header__taset">
          <p>包装</p>
          <p>5.0</p>
        </div>
        <div class="evaluate-line"></div>
        <div class="evaluate-header__taset">
          <p>配送</p>
          <p>5.0</p>
        </div>
      </div>
      <div class="body-line"></div>
      <div class="evaluate-screen">
        <div class="evaluate-screen__all">全部 841</div>
        <div class="evaluate-screen__item">最新</div>
        <div class="evaluate-screen__item">好评 826</div>
        <div class="evaluate-screen__difference">差评 4</div>
        <div class="evaluate-screen__item">有图 46</div>
      </div>
      <div class="evaluate-content">
        <p>
          <img src="../assets/选中.png" alt="">
          只看有内容的评价
        </p>
      </div>
      <div class="shopping-item" ref="wrapper">
        <div>
          <div @click="my" class="evaluation-item" v-for="(item, index) in evaluate" :key="index">
            <div class="evaluation-item__left">
              <img src="../assets//icon/shangchao.png" alt="">
            </div>
            <div class="evaluation-item__right">
              <p>
                <span>{{item.username}}</span>
                <span>{{item.rated_at}}</span>
              </p>
              <p>
                <span>❤❤❤❤❤</span>
                <span>&nbsp;&nbsp;超赞</span>
              </p>
            </div>
          </div>
        </div>
      </div>
    <!-- </div> -->
  </div>
</template>

<script>
import BScroll from 'better-scroll'

export default {
  name: 'ShoppingEvaluate',
  data () {
    return {
      imgShopUrl: 'https://elm.cangdu.org/img/',
      id: this.$route.query.ShopId,
      evaluate: []
    }
  },
  created () {
    this.$http.ShoppingEvaluate({
      restaurant_id: this.id
    }).then(res => {
      window.console.log(res.data)
      this.evaluate = res.data
    }).catch(err => {
      window.console.log(err)
    })
  },
  methods: {
    my () {
      this.$router.push({ name: 'My' })
    }
  },
  mounted () {
    this.scroller = new BScroll(this.$refs.wrapper, {
      scrollY: true,
      click: true,
      // 下拉刷新
      pullDownRefresh: {
        threshold: 50,
        stop: 0
      },
      // 上拉加载
      pullUpLoad: {
        threshold: 50
      }
    })
  }
}
</script>

<style scoped lang=scss>
  *{
    margin: 0px;
    padding: 0px;
    list-style: none;
  }
  .shopping-evaluate{
    /* width: 100%;
    height: 1334px; */
    background-color: #fff;
    /* .evaluate-body{ */
      width: 100%;
      height: 730px;
      .evaluate-header{
        width: 95%;
        height: 190px;
        margin: 0px auto;
        display: flex;
        justify-content: space-around;
        align-items: center;
        .evaluate-font{
          color: #ff6002;
          width: 22%;
          text-align: center;
          font-size: 58px;
        }
        .evaluate-header__item{
          width: 18%;
          height: 65px;
          p:nth-child(1){
            font-size: 24px;
            color: #666;
          }
          p:nth-child(2){
            margin-top: 12px;
            font-size: 21px;
            color: #ffb400;
          }
        }
        .evaluate-line{
          width: 1%;
          height: 90px;
          border-right: 1px solid #ddd;
        }
        .evaluate-header__taset{
          width: 17%;
          height: 85px;
          text-align: center;
          p:nth-child(1){
            font-size: 23px;
            color: #666;
          }
          p:nth-child(2){
            margin-top: 20px;
            font-size: 32px;
            color: #666;
          }
        }
      }
      .body-line{
        width: 100%;
        height: 20px;
        background-color: #f5f5f5;
      }
      .evaluate-screen{
        width: 95%;
        height: 108px;
        margin: 0px auto;
        border-bottom: 1px solid #eee;
        display: flex;
        align-items: center;
        justify-content: space-around;
        .evaluate-screen__all{
          font-size: 26px;
          color: #fff;
          padding: 18px;
          background-color: #0297ff;
          border-radius: 5px;
        }
        .evaluate-screen__item{
          font-size: 26px;
          color: #87929e;
          padding: 18px;
          background-color: #ebf5ff;
          border-radius: 5px;
        }
        .evaluate-screen__difference{
          font-size: 26px;
          color: #aaa;
          padding: 18px;
          background-color: #f5f5f5;
          border-radius: 5px;
        }
      }
      .evaluate-content{
        width: 95%;
        height: 80px;
        margin: 0px auto;
        border-bottom: 1px solid #eee;
        display: flex;
        align-items: center;
        p{
          margin-left: 24px;
          font-size: 28px;
          color: #666;
          img{
            width: 28px;
            vertical-align: middle;
          }
        }
      }
      .shopping-item{
        width: 100%;
        height: 650px;
        overflow: hidden;
        .evaluation-item{
          width: 95%;
          height: 128px;
          margin: 0px auto;
          border-bottom: 1px solid #eee;
          display: flex;
          align-items: center;
          justify-content: space-between;
          .evaluation-item__left{
            width: 10%;
            height: 65px;
            border-radius: 50%;
            overflow: hidden;
            background-color: #abcdef;
            img{
              width: 100%;
            }
          }
          .evaluation-item__right{
            width: 88%;
            height: 86px;
            p:nth-child(1){
              width: 100%;
              height: 30px;
              display: flex;
              align-items: center;
              justify-content: space-between;
              span:nth-child(1){
                color: #333;
                font-size: 23px;
              }
              span:nth-child(2){
                color: #bebebe;
                font-size: 23px;
              }
            }
            p:nth-child(2){
              width: 100%;
              height: 35px;
              margin-top: 18px;
              span:nth-child(1){
                color: #feb400;
                font-size: 24px;
              }
              span:nth-child(2){
                color: #ffae86;
                font-size: 24px;
              }
            }
          }
        }
      }
    /* } */
  }
</style>
